﻿@model SysClient
@{
	ViewBag.Title = "会员登记表";
}
<div class="ui-widget-header">
	<div style="padding: 5px 10px; font-size: 120%">
		@ViewBag.Title
	</div>
</div>
@using (Ajax.BeginForm(null, null, new AjaxOptions { UpdateTargetId = "Main" }, new { @class = "form-edit" }))
{
	<fieldset>
		<legend>基本信息
			<a href="#" class="save">[保存]</a>
			@if (Model.ID > 0)
   {@Html.ActionLink("[打印]", "Print", new { id = Model.ID, auto = true }, new { @class = "print" })}
		</legend>
		<div class="ui-content-info" id="contentInfo">
			@if (Model.Blocked)
   {
				<b>你添加的会员是黑名单会员</b>
				<a href="#" class="restore">[恢复]</a>
   }
		</div>
		<div class="ui-content">
			<div class="ui-cell ui-cell-full">
				@Html.ValidationSummary()
			</div>
			<div class="ui-cell">
				<label>会员编号</label>
				@if (Model.ID > 0)
	{@Html.HiddenFor(p => p.ID)}
				@Html.EditorFor(p => p.SysNo)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>电话</label>
				@Html.EditorFor(p => p.Telphone)
				<div>多个之间用“,”分开</div>
			</div>
			<div class="ui-cell">
				<label>姓名</label>
				@Html.EditorFor(p => p.Name)
			</div>
			<div class="ui-cell">
				<label>性别</label>
				@Html.DropDownListFor(p => p.Gender, ViewBag.Gender as SelectList)
			</div>
			<div class="ui-cell">
				<label>出生年月</label>
				@Html.TextBox("Birthday", string.Format("{0:yyyy-MM-dd}", Model.Birthday))
			</div>
			<div class="ui-cell">
				<label>学历</label>
				@Html.DropDownListFor(p => p.Education, ViewBag.Education as SelectList)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>籍贯</label>
				@Html.DropDownListFor(p => p.ProvinceSysNo, ViewBag.ProvinceSysNo as SelectList, new { @class = "s" })
				<span>省</span>
				@Html.DropDownListFor(p => p.CitySysNo, ViewBag.CitySysNo as SelectList, new { @class = "s" })
				<span>市</span>
			</div>
		</div>
	</fieldset>
	<fieldset>
		<legend>详细信息
			<a href="#" class="save">[保存]</a>
		</legend>
		<div class="ui-content">
			<div class="ui-cell ui-cell-full">
				@Html.ValidationSummary()
			</div>
			<div class="ui-cell">
				<label>专业</label>
				@Html.EditorFor(p => p.Professional)
			</div>
			<div class="ui-cell">
				<label>民族</label>
				@Html.DropDownListFor(p => p.Ethnic, ViewBag.Ethnic as SelectList)
			</div>
			<div class="ui-cell">
				<label>身高(cm)</label>
				@Html.EditorFor(p => p.Height)
			</div>
			<div class="ui-cell">
				<label>体重(kg)</label>
				@Html.EditorFor(p => p.BodyWeight)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>申请工作</label>
				@Html.EditorFor(p => p.LastWork)
				<div>多个之间用“,”分开</div>
			</div>
			<div class="ui-cell ui-cell-full">
				<label>身份证号</label>
				@Html.EditorFor(p => p.IdNo)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>证件地址</label>
				@Html.EditorFor(p => p.IdAddr)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>现住地址</label>
				@Html.EditorFor(p => p.Address)
			</div>
			<div class="ui-cell">
				<label>婚姻状况</label>
				@Html.DropDownListFor(p => p.Marriage, ViewBag.Marriage as SelectList)
			</div>
			<div class="ui-cell">
				<label>视力</label>
				@Html.DropDownListFor(p => p.Vision, ViewBag.Vision as SelectList)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>工作描述</label>
				@Html.TextAreaFor(p => p.Description)
			</div>
			<div class="ui-cell">
				<label>薪资要求</label>
				@Html.TextBoxFor(p => p.Salery, new { @class = "s" })
				(元/月以上)
			</div>
			<div class="ui-cell">
				<label>能否加班</label>
				@Html.DropDownListFor(p => p.Overtime, ViewBag.Overtime as SelectList)
			</div>
			<div class="ui-cell">
				<label>工作地点</label>
				@Html.EditorFor(p => p.Workplace)
			</div>
			<div class="ui-cell">
				<label>能否翻班</label>
				@Html.DropDownListFor(p => p.WayOfWorking, ViewBag.WayOfWorking as SelectList)
			</div>
			<div class="ui-cell">
				<label>休息要求</label>
				@Html.DropDownListFor(p => p.WayOfRelaxing, ViewBag.WayOfRelaxing as SelectList)
			</div>
			<div class="ui-cell">
				<label>在职情况</label>
				@Html.DropDownListFor(p => p.WorkStatue, ViewBag.WorkStatue as SelectList)
			</div>
			<div class="ui-cell">
				<label>工作经验</label>
				@Html.DropDownListFor(p => p.WorkExpress, ViewBag.WorkExpress as SelectList)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>毕业学校</label>
				@Html.EditorFor(p => p.Graduate)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>电子邮箱</label>
				@Html.EditorFor(p => p.Email)
			</div>
			<div class="ui-cell ui-cell-full">
				<label>证书</label>
				@Html.EditorFor(p => p.Certifcate)
				<div>多个之间用“,”分开</div>
			</div>
			<div class="ui-cell ui-cell-full">
				<label>从事工种</label>
				@Html.EditorFor(p => p.TypeOfWorking)
				<div>多个之间用“,”分开</div>
			</div>
			<div class="ui-cell">
				<label>英语水平</label>
				@Html.DropDownListFor(p => p.EnglishLvl, ViewBag.EnglishLvl as SelectList)
			</div>
			<div class="ui-cell">
				<label>电脑水平</label>
				@Html.DropDownListFor(p => p.ComputerLvl, ViewBag.ComputerLvl as SelectList)
			</div>
		</div>
	</fieldset>
	if (Model.ID > 0)
	{
	<fieldset>
		<legend>工作经历
				@Html.ActionLink("[添加]", "EditWorking", new { pid = Model.ID }, new { @class = "subadd", title = "添加 工作经历" })
		</legend>
		<div class="ui-content">
			<table>
				@foreach (var item in Model.SysClientWorking)
	{
		
					<tr>
						<td class="b">@(item.YearFrom)年@(item.MonthFrom)月到@(item.YearTo)年@(item.MonthTo)月</td>
						<td class="b">@(item.Caption) @(item.Title)</td>
						<td style="width: 150px;" class="aright">
							@Html.ActionLink("[修改]", "EditWorking", new { wid = item.ID }, new { @class = "subadd", title = "修改 工作经历" })
							@Html.ActionLink("[删除]", "DelWorking", new { wid = item.ID }, new { @class = "subdel" })
						</td>
					</tr>
					<tr>
						<td></td>
						<td>@(item.Description)</td>
						<td></td>
					</tr>
	}
			</table>
		</div>
	</fieldset>
	<fieldset>
		<legend>教育培训
				@Html.ActionLink("[添加]", "EditTraining", new { pid = Model.ID }, new { @class = "subadd", title = "添加 教育培训" })
		</legend>
		<div class="ui-content">
			<table>
				@foreach (var item in Model.SysClientTraining)
	{
		
					<tr>
						<td class="b">@(item.YearFrom)年@(item.MonthFrom)月到@(item.YearTo)年@(item.MonthTo)月</td>
						<td class="b">@(item.Caption) @(item.Title)</td>
						<td>
							@Html.ActionLink("[修改]", "EditTraining", new { wid = item.ID }, new { @class = "subadd", title = "修改 教育培训" })
							@Html.ActionLink("[删除]", "DelTraining", new { wid = item.ID }, new { @class = "subdel" })
						</td>
					</tr>
					<tr>
						<td></td>
						<td>@(item.Description)</td>
						<td></td>
					</tr>
	}
			</table>
		</div>
	</fieldset>
	}
}
<script type="text/javascript">
	function validate() {
		if ($("#ID").length > 0) return;
		var name = $("#Name").val();
		var birthday = $("#Birthday").val();
		if (name == "" || birthday == "") return;
		$.post("@Url.Action("ValidateClient")", {
			Name: name,
			Birthday: birthday
		}, function (res) {
			$("#contentInfo").html(res);
		});
	}
	setTimeout(function () {
		window.datachanged = false;
		window.uri = "@Url.Action("Edit", new { ID = Model.ID })";
		$("#Name").bind("blur", validate), $("#Birthday").bind("change", validate),
		new Calendar({
			trigger: "Birthday",
			inputField: "Birthday",
			showTime: false,
			onSelect: function () {
				this.hide();
				validate();
			}
		});
		$("#ProvinceSysNo").change(function () {
			$("#CitySysNo").load("@Url.Action("PCity")?provinceSysNo=" + ($(this).val() || "0"))
		})
		$("a.restore").click(function () {
			$.post(window.uri, {Blocked:false}, function (res) {
				$("#Main").load(window.uri);
			})
		});
		$("a.save").click(function () { $(this).parents("form").submit() });
		$("a.subdel").click(function () {
			if (confirm("你真的要删除这条数据吗？")) {
				$.post($(this).attr("href"), {}, function (res) {
					//alert(res.msg);
					res.res && $("#Main").load(window.uri);
				})
			}
			return false;
		})
		$("a.subadd").click(function () {
			var ttl = $(this).attr("title");
			$.get($(this).attr("href"), {}, function (data) {
				_d = $("<div id='subMain'></div>").html(data).dialog({
					title: ttl,
					modal: true,
					autoOpen: true,
					width: 550,
					position: ['0', 'center'],
					close: function () { _d.remove(); window.datachanged && $("#Main").load(window.uri); }
				});
			})
			return false;
		});
	}, 0);
</script>
